// 测试登录API的脚本
// 使用方法: node test-auth.js
const testLogin = async () => {
  try {
    const testData = {
      clientInfo: {
        uniPlatform: "web",
        appId: "__UNI__3C0EDFA",
        deviceId: "test-device-123"
      },
      username: "testuser",
      password: "testpass123",
      code: "1234"
    };

    console.log('发送登录请求:', testData);

    const response = await fetch('http://localhost:3000/api/auth/login', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(testData)
    });

    const result = await response.json();
    console.log('API响应:', result);

    if (response.ok) {
      console.log('✅ 登录API测试成功');
    } else {
      console.log('❌ 登录API测试失败:', response.status);
    }
  } catch (error) {
    console.error('❌ 测试过程中发生错误:', error.message);
  }
};

console.log('开始测试登录API...');
testLogin();
